Skip to content

fix(ios): prevent SwiftUI filter content collapse after view recycling#57643

Open
lujjjh wants to merge 1 commit into
react:mainfrom
lujjjh:fix/ios-swiftui-filter-safe-area
Open

fix(ios): prevent SwiftUI filter content collapse after view recycling#57643
lujjjh wants to merge 1 commit into
react:mainfrom
lujjjh:fix/ios-swiftui-filter-safe-area

Conversation

@lujjjh

@lujjjh lujjjh commented Jul 23, 2026

Copy link
Copy Markdown

Summary:

Fixes #57642

SwiftUI-based filters can render with zero-height content after Fabric recycles a view, even though the outer React Native view and hosting view retain their expected dimensions.

This disables safe-area handling for the internal UIHostingController, since its layout is already controlled by React Native:

  • Uses safeAreaRegions = [] on iOS 16.4 and later.
  • Applies the equivalent safeAreaInsets override only to the hosting view instance on earlier supported versions.

Changelog:

[IOS] [FIXED] - Prevent SwiftUI-based filter content from collapsing after view recycling.

Test Plan:

  • Reproduced the issue on the two iOS versions tested: iOS 16.0 and iOS 26.5.
  • Verified that the filtered content remains visible after applying the fix on both versions.

@meta-cla

meta-cla Bot commented Jul 23, 2026

Copy link
Copy Markdown

Hi @lujjjh!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Jul 23, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 23, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jul 23, 2026
@cipolleschi

Copy link
Copy Markdown
Contributor

I don't think this is the right fix. This is doing a lot of shenaningan with the objc runtime to fix a recycle issue.
I think that the right fix is to make sure that the filter is actually recycled or that the props are forwarded and applied properly to the SwiftUI view.
@intergalacticspacehighway: do you mind having a look at the issue and suggest a better approach, given that you worked on the implementation?
@lujjjh it would be great if you can provide a reproducer in RNTester app (we have a playground.js file you can use) so we can verify the issue ourselves and look for a better fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SwiftUI-based filter content collapses after Fabric view recycling on iOS

2 participants